package net.digitalprimates.flex2.uint.sequence
{
  import flash.events.IEventDispatcher;
  
  import net.digitalprimates.flex2.uint.sequence.ISequenceAction;

  /**
   * A function invocation in a sequence.
   */
  public class SequenceAction implements ISequenceAction
  {
    private var object : Object;
    private var methodName : String;
    private var arguments : Array;
    
    /**
     * Constructor.
     * 
     * @param object object where method lives
     * @param methodName name of the method
     * @param arguments arguments to pass method
     */
    public function SequenceAction(object : Object, methodName : String, arguments : Array = null)
    {
      this.object = object;
      this.methodName = methodName;
      this.arguments = arguments;
    }

    public function get target():IEventDispatcher
    {
      return null;
    }
    
    public function execute():void
    {
      (object[methodName] as Function).apply(object, arguments);
    }
    
  }
}